package kpython.backend.translator;

public class TranslatorUtils {

	public static String generateHeader() {
		StringBuilder header = new StringBuilder();
		header.append("#include \"frame.h\"\n");
		header.append("#include <stdlib.h>\n");
		header.append("#include <stdio.h>\n");		
		header.append("#include <string.h>\n");
		header.append("int main() \n{\n");
		return header.toString();
	}
	public static String generateRegisters() {
		StringBuilder registers = new StringBuilder();		
		registers.append("//return address\n");		
		registers.append("int _ra = 0;\n");
		registers.append("int register_counter = 32;\n");
		registers.append("//return value\n");
		registers.append("var *_rv = (var*)malloc(sizeof(var));\n");		
		return registers.toString();
	}
	
	public static String generateFooter() {
		StringBuilder header = new StringBuilder();		
		header.append("exit:\n");		
		header.append("return 0;\n");		
		header.append("}\n");
		return header.toString();
	}
	
}
